// import { organizationsApiConfig } from '@choerodon/master';

export default ({ level, mailApiConfig }:{level:'site'|'organization', mailApiConfig:any}) => {
  const readUrl = level === 'site' ? mailApiConfig.siteGetMailTemplateConfig().url : mailApiConfig.orgGetMailTemplateConfig().url;
  const exportObj = {
    autoCreate: true,
    fields: [
      {
        name: 'logo',
        label: '邮件Logo',
      },
      {
        name: 'slogan',
        label: '邮件标语',
        maxLength: 15,
      },
      {
        name: 'footer',
        label: '邮件页脚',
      },
      {
        name: 'preview',
        label: '预览',
      },
    ],
    transport: {
      read: {
        url: readUrl,
        method: 'get',
      },
    },
  };
  if (level === 'organization') {
    const obj:any = {
      name: 'custom',
      label: '邮件模板设置',
      type: 'boolean',
    };
    exportObj.fields.push(obj);
  }
  return exportObj;
};
